Repository navigation
feat!: normalize URL fields in responses - #1045
Merged
Merged
Conversation
Fields the OpenAPI specification marks as `format: uri` are validated with
`z.url({ normalize: true })`, so the client hands back the WHATWG URL
serialization the way the Python client's `pydantic.AnyUrl` does, and the
two clients return the same string for the same field.
Closes #1028
BREAKING CHANGE: URL fields in responses (`containerUrl`, `consoleUrl`,
`standbyUrl`, `requestUrl`, `url`, `pictureUrl`, `userPictureUrl`,
`websiteUrl` and the `*PublicUrl` fields) come back normalized: an empty
path gains a trailing slash, the host is lowercased and punycoded, a
default port is dropped and unsafe characters are percent-encoded. A value
that is not a valid absolute URL now throws `ResponseValidationError`.
Contributor
|
See more at https://github.com/apify/apify-client-js/actions/runs/34338282630#summary-102422751439 |
B4nan
pushed a commit
that referenced
this pull request
Sep 30, 2026
Fields the OpenAPI specification marks as `format: uri` are validated
with `z.url({ normalize: true })`, so the client returns the WHATWG URL
serialization rather than the raw string the API sent. The Python client
normalizes the same fields through `pydantic.AnyUrl`, so both clients
now return the same string for the same field. On the Python side that
normalization was kept and documented in apify/apify-client-python#1005,
and this PR follows the same decision.
Normalization adds a trailing slash to an empty path, lowercases and
punycodes the host, drops a default port, and percent-encodes unsafe
characters. The specification carries `format: uri` on 17 properties,
none of them on request-queue requests. Field types stay `string`, and a
value that isn't a valid absolute URL now throws
`ResponseValidationError`. `format: email` is left as a plain string,
since the issue is about URL fields.
The v3 upgrading guide gets a "URL fields are normalized" section
mirroring the Python one: the normalization cases, how to compare a
field against a stored URL, and the affected field names. The
error-handling page points at it.
Closes #1028
*✍️ Drafted by Claude Code*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fields the OpenAPI specification marks as
format: uriare validated withz.url({ normalize: true }), so the client returns the WHATWG URL serialization rather than the raw string the API sent. The Python client normalizes the same fields throughpydantic.AnyUrl, so both clients now return the same string for the same field. On the Python side that normalization was kept and documented in apify/apify-client-python#1005, and this PR follows the same decision.Normalization adds a trailing slash to an empty path, lowercases and punycodes the host, drops a default port, and percent-encodes unsafe characters. The specification carries
format: urion 17 properties, none of them on request-queue requests. Field types staystring, and a value that isn't a valid absolute URL now throwsResponseValidationError.format: emailis left as a plain string, since the issue is about URL fields.The v3 upgrading guide gets a "URL fields are normalized" section mirroring the Python one: the normalization cases, how to compare a field against a stored URL, and the affected field names. The error-handling page points at it.
Closes #1028
✍️ Drafted by Claude Code